package ar.edu.unlam.lyc.comunes;

import java.util.Hashtable;

public class SimbolosReservados {
	private static SimbolosReservados instance = null;
	private Hashtable<String, String> lista = null;
	private Hashtable<String, String> lista2 = null;

	private SimbolosReservados() {
		this.lista = new Hashtable<String, String>();
		this.lista2 = new Hashtable<String, String>();

		this.lista2.put("==", "OPC_EQT");
		this.lista.put("OPC_EQT", "==");

		this.lista2.put(">", "OPC_GT");
		this.lista.put("OPC_GT", ">");

		this.lista2.put(">=", "OPC_GET");
		this.lista.put("OPC_GET", ">=");

		this.lista2.put("<", "OPC_LT");
		this.lista.put("OPC_LT", "<");

		this.lista2.put("<=", "OPC_LET");
		this.lista.put("OPC_LET", "<=");

		this.lista2.put("!=", "OPC_NEQ");
		this.lista.put("OPC_NEQ", "!=");

		this.lista2.put(":=", "OP_ASG");
		this.lista.put("OP_ASG", ":=");

		this.lista2.put("+", "OP_SUM");
		this.lista.put("OP_SUM", "+");

		this.lista2.put("-", "OP_RES");
		this.lista.put("OP_RES", "-");

		this.lista2.put("*", "OP_MUL");
		this.lista.put("OP_MUL", "*");

		this.lista2.put("/", "OP_DIV");
		this.lista.put("OP_DIV", "/");

		this.lista2.put("(", "PA_OP");
		this.lista.put("PA_OP", "(");

		this.lista2.put(")", "PA_CL");
		this.lista.put("PA_CL", ")");

		this.lista2.put("[", "CO_OP");
		this.lista.put("CO_OP", "[");

		this.lista2.put("]", "CO_CL");
		this.lista.put("CO_CL", "]");

		this.lista2.put(",", "SEP_ARG");
		this.lista.put("SEP_ARG", ",");

		this.lista2.put(";", "SEP_FS");
		this.lista.put("SEP_FS", ";");

		this.lista2.put(":", "SEP_DCL");
		this.lista.put("SEP_DCL", ":");

	}

	public static SimbolosReservados getInstance() {
		if (instance == null) {
			instance = new SimbolosReservados();
		}
		return instance;
	}

	public boolean contains(String str) {
		return this.lista.contains(str);
	}

	public String getMnemonic(String str) {
		return (String) lista2.get(str);
	}
}